Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Use connection dropdown#692

Merged
gzdunek merged 2 commits intomasterfrom
gzdunek/use-connection-dropdown
Mar 24, 2022
Merged

Use connection dropdown#692
gzdunek merged 2 commits intomasterfrom
gzdunek/use-connection-dropdown

Conversation

@gzdunek
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek commented Mar 23, 2022

px="2"
mx="2"
as={NavLink}
as={url ? NavLink : null}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In teleterm we don't have classical routing, so rendering NavLink causes errors (that it should be used in context of Router)

@gzdunek gzdunek requested review from kimlisa and ravicious March 23, 2022 13:00
px="2"
mx="2"
as={NavLink}
as={url ? NavLink : null}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change it so that instead of rendering a div when there's no URL it renders a button styled as a link instead? This actually provides keyboard support OOTB and helps us avoid having onClicks on divs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I had to add Flex container to the items in menu, because Button was going outside ofMenu.

onClick={() => {
connect(serverUri);
<MenuSshLogin
menuListCss={menuListCss}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been here for just two months, so I suppose @kimlisa might have something more to say. But long-term, injecting arbitrary CSS seems to me like a wrong way of modifying the appearance of a shared component.

Ideally I suppose everything should work OOTB after we change the theme in Teleterm. However, I noticed that the way we use the theme is color-oriented rather than purpose-oriented.

const StyledMenuItem = styled(MenuItem)(
({ theme }) => `
color: ${theme.colors.grey[400]};
font-size: 12px;
border-bottom: 1px solid ${theme.colors.subtle};
min-height: 32px;
&:hover {
color: ${theme.colors.link};

const StyledMenuList = styled.div`
background-color: ${props => props.theme.colors.light};

I might be wrong, but I think this makes it harder to reuse components, because theme.colors.light might mean different things in different contexts. I saw a good thread about that a couple of days ago which goes into detail about this issue.

OTOH, taking care of that is probably out of scope for this PR.

One solution which comes to my mind is having a special copy of the theme in Teleterm which will override the Teleterm theme in places like this one here where we really need to bend a shared component to make it look a certain way. This means that in this context theme.colors.light could be something entirely else than it is in the general Teleterm theme. What do you think about this idea?

Copy link
Copy Markdown
Contributor

@kimlisa kimlisa Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i honestly don't have strong opinions on this matter :)

and if i understood you correctly, i think we do something similar to what you suggested where we use our own custom colors (our console view theme is darker than our normal teleport theme):

  1. define custom colors to use throughout console view
  2. custom theme provider using custom colors
  3. usage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for detailed comment, I agree!
I chose the way with css styling to apply more complicated changes like: different border radius, no separator between items, rounded corners of hovered item.
However, since we have agreed that color customization is sufficient, styling using a provider is simple.

@gzdunek gzdunek force-pushed the gzdunek/use-connection-dropdown branch from 6c07d21 to 07987d0 Compare March 24, 2022 14:39
Copy link
Copy Markdown
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran into some problems when testing how this change impacts the web UI.

border-radius: 4px;
box-sizing: border-box;
color: #263238;
color: ${theme.colors.blueGrey[900]};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to check if the change from <React.Fragment> to <Flex flexDirection="column"> doesn't change anything in the web UI, but when I try to use the web UI on this branch I get "theme.colors.blueGrey is undefined" after clicking on Connect.

Could you make sure that this change and the <React.Fragment> change don't cause problems for the web UI?

Copy link
Copy Markdown
Contributor Author

@gzdunek gzdunek Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested that change in the web UI as well...
If only I had noticed that I am testing on localhost:3080, not localhost:8080 🙄🙄

Fixed

@gzdunek gzdunek force-pushed the gzdunek/use-connection-dropdown branch from 07987d0 to 0469e21 Compare March 24, 2022 15:33
Copy link
Copy Markdown
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, forgot to mention that I totally forgot that the dropdown from the Web UI looks as if it was one of our pickers (an input at the top plus a list of possible results), but works in a completely different way. 😬 The input doesn't really limit down the list of possible options and so on.

But let's see what the team thinks about it. We can change that to a filterable list or something if it turns out to be a problem.

@gzdunek gzdunek force-pushed the gzdunek/use-connection-dropdown branch from 0469e21 to 8c8ce64 Compare March 24, 2022 15:47
@gzdunek gzdunek force-pushed the gzdunek/use-connection-dropdown branch from 8c8ce64 to 0234cda Compare March 24, 2022 15:59
@gzdunek
Copy link
Copy Markdown
Contributor Author

gzdunek commented Mar 24, 2022

Force-push to re-trigger builds

@gzdunek gzdunek merged commit f8cfdf3 into master Mar 24, 2022
@gzdunek gzdunek deleted the gzdunek/use-connection-dropdown branch March 24, 2022 16:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants